// 创建store，导出
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
// 浏览器调试工具
import { composeWithDevTools } from 'redux-devtools-extension'
import rootReducer from './reducers'

let middlewares
if(process.env.NODE_ENV === 'production'){
    // 生产环境不要调试工具
    middlewares = applyMiddleware(thunk)
}else {
    middlewares = composeWithDevTools(applyMiddleware(thunk))
}
const store = createStore(rootReducer, middlewares)

export default store